home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / powerb5.zip / P5DOS002.TIP < prev    next >
Text File  |  1993-06-01  |  2KB  |  39 lines

  1. In "50 Tips for DOS and Windows," Kay Nelson suggested
  2. putting quotes around redirection symbols when using REM to
  3. comment out lines in a batch file ("Help for Batch File
  4. Fanatics," January 1992, page 209). I prefer to use a colon,
  5. as in :REM, at the beginning of any comment line. This
  6. causes DOS to think that the line is a label, and
  7. redirection symbols on the line are therefore ignored. Also,
  8. even if ECHO is on, DOS won't echo the line to the screen.
  9.  
  10. Chan Shippy
  11. Colome, South Dakota
  12.  
  13. Editor's Note: For several reasons, I use colons instead of
  14. REM when I place comments in my batch files. First, as Mr.
  15. Shippy points out, there's no need to worry about DOS
  16. reacting to redirection symbols on the line in unexpected
  17. ways; second, the line is never echoed regardless of the
  18. ECHO state. Finally, DOS skips over a line that starts with
  19. a colon without trying to interpret it any further, and gets
  20. right on with the work of handling the next line. This makes
  21. the entire batch file run much faster, especially if you've
  22. put in lots of comments.
  23.  
  24. I don't recommend using :REM as your standard way to set off
  25. a comment, though. One day when you least expect it you may
  26. have a reason to use the word REM as a label (it's a
  27. perfectly legal label, as are all DOS batch commands). My
  28. suggestion: Use a colon followed by an asterisk (:*)
  29. instead. An asterisk isn't a legal label, and it draws
  30. attention to the comment.
  31.  
  32.  
  33. Title: Colons for Comments
  34. Category: DOS
  35. Issue Date: June, 1992
  36. Editor: Brett Glass
  37. Supplementary Files: None
  38. Filename: P5DOS002.TIP
  39.